package com.freewater.springboot.demo.ioc.value;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(AppConfig.class);
        applicationContext.refresh();
        applicationContext.registerShutdownHook(); // 注册jvm关闭回调，jvm关闭时一并关闭spring容器
        final MovieRecommender movieRecommender = applicationContext.getBean(MovieRecommender.class);
        System.out.println(movieRecommender.getCatalog());
        System.out.println(movieRecommender.getUserHome());
        System.out.println(movieRecommender.getCountOfMoviesPerCatalog());
    }
}
